package com.tcc.demo.order.service;

import com.tcc.annotation.Tcc;
import org.springframework.stereotype.Service;

/**
 * @Author: admin
 * @Description:
 * @Date: 2018/10/25 17:49
 */

@Service
public class HomeService {
    @Tcc(confirmMethod = "confirmOrder", cancelMethod = "cancelOrder")
    public void order(String name) throws Throwable {
        System.out.println("HomeService::hello " + name);
        if ("sjw".equals(name)) throw new Throwable();
    }

    public void confirmOrder(String name) {
        System.out.println("HomeService::confirmOrder " + name);
    }

    public void cancelOrder(String name) {
        System.out.println("HomeService::cancelOrder " + name);
    }
}
